<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CU安全信息</title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script src="http://lib.sinaapp.com/js/bootstrap/v3.0.0/js/bootstrap.js"></script>
<link href="http://lib.sinaapp.com/js/bootstrap/v3.0.0/css/bootstrap-theme.min.css" rel="stylesheet" />
<link href="http://lib.sinaapp.com/js/bootstrap/v3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<!-- 	<script src="//cdn.bootcss.com/angular.js/1.6.4/angular.min.js"></script> -->
</head>
<body>
	<div ng-app="security_report" ng-controller="securityReportController">
		<table class="table">
			<th>
<!-- 				<td style="{{$even?'background-color: #f1f1f1':''}}">序号</td> -->
				<td style="{{$even?'background-color: #f1f1f1':''}}">目标IP</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">源IP</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">机房ID</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">域名</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">采集时间</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">Url</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">录入时间</td>
			</th>
			<tr ng-repeat="report in reports">
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{$index + 1}}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.destIp }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.srcIp }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.houseId }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.domainName }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.gatherTime }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.url }}</td>
				<td style="{{$even?'background-color: #f1f1f1':''}}">{{ report.find_time }}</td>
			</tr>
		</table>
	</div>
	<script>
		var app = angular.module('security_report', []);
		app.controller('securityReportController', function($scope, $http, $timeout) {
			var loop = function() {
				$timeout(function(){
					getReport();
					loop();
		          },2000);
			};
			var getReport = function(){
				$http.get("security/result").then(function(response) {
					$scope.reports = response.data;
				});
			}
			getReport();
			loop();
		});
	</script>
</body>
</html>